package br.com.datasun.biblioteca.ui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JPasswordField;

import br.com.datasun.biblioteca.entities.TipoUsuario;

import images.ImageLoader;

public class CadastroClientesUsuarioUI extends JDialog {

	private final JPanel contentPanel = new JPanel();
	private JTextField txtLogin;
	private JPasswordField pwdNovasenha;
	private JPasswordField pwdRepitasenha;
	private JComboBox cmbTipoPessoa = new JComboBox();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			CadastroClientesUsuarioUI dialog = new CadastroClientesUsuarioUI();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public CadastroClientesUsuarioUI() {
		setTitle("Definição de usuário e senha de acesso");
		setBounds(100, 100, 557, 288);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		GridBagLayout gbl_contentPanel = new GridBagLayout();
		gbl_contentPanel.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0};
		gbl_contentPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		gbl_contentPanel.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_contentPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		contentPanel.setLayout(gbl_contentPanel);
		{
			JLabel lblNewLabel = new JLabel("New label");
			GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
			gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
			gbc_lblNewLabel.gridx = 4;
			gbc_lblNewLabel.gridy = 0;
			contentPanel.add(lblNewLabel, gbc_lblNewLabel);
		}
		{
			JLabel lblNewLabel_1 = new JLabel("New label");
			GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
			gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 0);
			gbc_lblNewLabel_1.gridx = 5;
			gbc_lblNewLabel_1.gridy = 0;
			contentPanel.add(lblNewLabel_1, gbc_lblNewLabel_1);
		}
		{
			JLabel lblTipo = new JLabel("Tipo");
			GridBagConstraints gbc_lblTipo = new GridBagConstraints();
			gbc_lblTipo.anchor = GridBagConstraints.EAST;
			gbc_lblTipo.insets = new Insets(0, 0, 5, 5);
			gbc_lblTipo.gridx = 1;
			gbc_lblTipo.gridy = 1;
			contentPanel.add(lblTipo, gbc_lblTipo);
		}
		{
			
			GridBagConstraints gbc_cmbTipoPessoa = new GridBagConstraints();
			gbc_cmbTipoPessoa.gridwidth = 2;
			gbc_cmbTipoPessoa.insets = new Insets(0, 0, 5, 5);
			gbc_cmbTipoPessoa.fill = GridBagConstraints.HORIZONTAL;
			gbc_cmbTipoPessoa.gridx = 2;
			gbc_cmbTipoPessoa.gridy = 1;
			contentPanel.add(cmbTipoPessoa, gbc_cmbTipoPessoa);
		}
		{
			JLabel lblPessoa = new JLabel("Pessoa");
			GridBagConstraints gbc_lblPessoa = new GridBagConstraints();
			gbc_lblPessoa.anchor = GridBagConstraints.EAST;
			gbc_lblPessoa.insets = new Insets(0, 0, 5, 5);
			gbc_lblPessoa.gridx = 1;
			gbc_lblPessoa.gridy = 2;
			contentPanel.add(lblPessoa, gbc_lblPessoa);
		}
		{
			JLabel lblNomepessoa = new JLabel("NomePessoa");
			GridBagConstraints gbc_lblNomepessoa = new GridBagConstraints();
			gbc_lblNomepessoa.fill = GridBagConstraints.HORIZONTAL;
			gbc_lblNomepessoa.gridwidth = 3;
			gbc_lblNomepessoa.insets = new Insets(0, 0, 5, 5);
			gbc_lblNomepessoa.gridx = 2;
			gbc_lblNomepessoa.gridy = 2;
			contentPanel.add(lblNomepessoa, gbc_lblNomepessoa);
		}
		{
			JLabel lblCpf = new JLabel("CPF");
			GridBagConstraints gbc_lblCpf = new GridBagConstraints();
			gbc_lblCpf.anchor = GridBagConstraints.EAST;
			gbc_lblCpf.insets = new Insets(0, 0, 5, 5);
			gbc_lblCpf.gridx = 1;
			gbc_lblCpf.gridy = 3;
			contentPanel.add(lblCpf, gbc_lblCpf);
		}
		{
			JLabel lblNumerocpf = new JLabel("numeroCpf");
			GridBagConstraints gbc_lblNumerocpf = new GridBagConstraints();
			gbc_lblNumerocpf.fill = GridBagConstraints.HORIZONTAL;
			gbc_lblNumerocpf.gridwidth = 2;
			gbc_lblNumerocpf.insets = new Insets(0, 0, 5, 5);
			gbc_lblNumerocpf.gridx = 2;
			gbc_lblNumerocpf.gridy = 3;
			contentPanel.add(lblNumerocpf, gbc_lblNumerocpf);
		}
		{
			JLabel lblRg = new JLabel("RG");
			GridBagConstraints gbc_lblRg = new GridBagConstraints();
			gbc_lblRg.anchor = GridBagConstraints.EAST;
			gbc_lblRg.insets = new Insets(0, 0, 5, 5);
			gbc_lblRg.gridx = 1;
			gbc_lblRg.gridy = 4;
			contentPanel.add(lblRg, gbc_lblRg);
		}
		{
			JLabel lblNumerorg = new JLabel("numeroRg");
			GridBagConstraints gbc_lblNumerorg = new GridBagConstraints();
			gbc_lblNumerorg.fill = GridBagConstraints.HORIZONTAL;
			gbc_lblNumerorg.gridwidth = 2;
			gbc_lblNumerorg.insets = new Insets(0, 0, 5, 5);
			gbc_lblNumerorg.gridx = 2;
			gbc_lblNumerorg.gridy = 4;
			contentPanel.add(lblNumerorg, gbc_lblNumerorg);
		}
		{
			JLabel lblLogin = new JLabel("Login");
			GridBagConstraints gbc_lblLogin = new GridBagConstraints();
			gbc_lblLogin.anchor = GridBagConstraints.EAST;
			gbc_lblLogin.insets = new Insets(0, 0, 5, 5);
			gbc_lblLogin.gridx = 1;
			gbc_lblLogin.gridy = 5;
			contentPanel.add(lblLogin, gbc_lblLogin);
		}
		{
			txtLogin = new JTextField();
			txtLogin.setText("login");
			GridBagConstraints gbc_txtLogin = new GridBagConstraints();
			gbc_txtLogin.gridwidth = 3;
			gbc_txtLogin.insets = new Insets(0, 0, 5, 5);
			gbc_txtLogin.fill = GridBagConstraints.HORIZONTAL;
			gbc_txtLogin.gridx = 2;
			gbc_txtLogin.gridy = 5;
			contentPanel.add(txtLogin, gbc_txtLogin);
			txtLogin.setColumns(10);
		}
		{
			JLabel lblNovaSenha = new JLabel("Nova Senha");
			GridBagConstraints gbc_lblNovaSenha = new GridBagConstraints();
			gbc_lblNovaSenha.anchor = GridBagConstraints.EAST;
			gbc_lblNovaSenha.insets = new Insets(0, 0, 5, 5);
			gbc_lblNovaSenha.gridx = 1;
			gbc_lblNovaSenha.gridy = 6;
			contentPanel.add(lblNovaSenha, gbc_lblNovaSenha);
		}
		{
			pwdNovasenha = new JPasswordField();
			pwdNovasenha.setText("novaSenha");
			GridBagConstraints gbc_pwdNovasenha = new GridBagConstraints();
			gbc_pwdNovasenha.gridwidth = 2;
			gbc_pwdNovasenha.insets = new Insets(0, 0, 5, 5);
			gbc_pwdNovasenha.fill = GridBagConstraints.HORIZONTAL;
			gbc_pwdNovasenha.gridx = 2;
			gbc_pwdNovasenha.gridy = 6;
			contentPanel.add(pwdNovasenha, gbc_pwdNovasenha);
		}
		{
			JLabel lblRepitaSenha = new JLabel("Repita Senha");
			GridBagConstraints gbc_lblRepitaSenha = new GridBagConstraints();
			gbc_lblRepitaSenha.insets = new Insets(0, 0, 5, 5);
			gbc_lblRepitaSenha.anchor = GridBagConstraints.EAST;
			gbc_lblRepitaSenha.gridx = 1;
			gbc_lblRepitaSenha.gridy = 7;
			contentPanel.add(lblRepitaSenha, gbc_lblRepitaSenha);
		}
		{
			pwdRepitasenha = new JPasswordField();
			pwdRepitasenha.setText("repitaSenha");
			GridBagConstraints gbc_pwdRepitasenha = new GridBagConstraints();
			gbc_pwdRepitasenha.gridwidth = 2;
			gbc_pwdRepitasenha.insets = new Insets(0, 0, 5, 5);
			gbc_pwdRepitasenha.fill = GridBagConstraints.HORIZONTAL;
			gbc_pwdRepitasenha.gridx = 2;
			gbc_pwdRepitasenha.gridy = 7;
			contentPanel.add(pwdRepitasenha, gbc_pwdRepitasenha);
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton btnLimpar = new JButton();
				btnLimpar.setPreferredSize(new Dimension(115,25));
				btnLimpar.setIcon(ImageLoader.createImageIcon("btnLimpar115x25.png"));
				buttonPane.add(btnLimpar);
			}
			{
				JButton btnFechar = new JButton();
				btnFechar.setPreferredSize(new Dimension(115,25));
				btnFechar.setIcon(ImageLoader.createImageIcon("btnFechar115x25.png"));
				buttonPane.add(btnFechar);

			}
			{
				JButton btnSalvar = new JButton();
				btnSalvar.setPreferredSize(new Dimension(115,25));
				btnSalvar.setIcon(ImageLoader.createImageIcon("btnSalvar115x25.png"));
				buttonPane.add(btnSalvar);
			}
		}
		inicializarComboTipo();
	}
	
	public void inicializarComboTipo(){
		for (TipoUsuario tipo : TipoUsuario.values()) {
			cmbTipoPessoa.addItem(tipo);
		}
	}
}
